import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
            meta: { title: '自述文件', requireAuth: true },
            children: [
                {
                    path: '/dashboard',
                    component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Dashboard.vue'),
                    meta: { title: '系统首页', requireAuth: true }
                },
                {
                    path: '/link',
                    component: () => import(/* webpackChunkName: "icon" */ '../components/page/Link.vue'),
                    meta: { title: '友链管理', requireAuth: true }
                },
                {
                    path: '/message',
                    component: () => import(/* webpackChunkName: "icon" */ '../components/page/Message.vue'),
                    meta: { title: '留言管理', requireAuth: true }
                },
                {
                    path: '/comment',
                    component: () => import(/* webpackChunkName: "icon" */ '../components/page/Comment.vue'),
                    meta: { title: '评论管理', requireAuth: true }
                },
                {
                    path: '/classify',
                    component: () => import(/* webpackChunkName: "icon" */ '../components/page/Classify.vue'),
                    meta: { title: '分类管理', requireAuth: true }
                },
                {
                    path: '/resource',
                    component: () => import(/* webpackChunkName: "icon" */ '../components/page/Resource.vue'),
                    meta: { title: '资源管理', requireAuth: true }
                },
                {
                    path: '/photo',
                    component: () => import(/* webpackChunkName: "icon" */ '../components/page/Photo.vue'),
                    meta: { title: '相册管理', requireAuth: true }
                },
                {
                    path: '/user',
                    component: () => import(/* webpackChunkName: "form" */ '../components/page/User.vue'),
                    meta: { title: '用户管理', requireAuth: true }
                },
            ]
        },
        {
            path: '/login',
            component: () => import(/* webpackChunkName: "login" */ '../components/page/Login.vue'),
            meta: { title: '登录' }
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
});
